package com.report.reportserver.controller;

import com.report.reportserver.model.Menu;
import com.report.reportserver.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @ ClassName: PageController
 * @ Description：返回用户能看到的组件，不同的权限看到的东西不同
 * @ Modified By：
 * @ Version:
 * @ Author     ：LiYing
 * @ Date       ：Created in 18:46 2022/3/10
 */
@Controller
@RequestMapping(value = "/page")
public class PageController {
    @Autowired
    PageService pageService;

    @RequestMapping(value = "/getSecondLevelMenu")
    public @ResponseBody List<Menu> getFirstLevelMenu(HttpServletRequest request){
        int role = Integer.parseInt(request.getParameter("role"));
        List<Menu> list = pageService.queryMenuByRole(role);
        return list;
    }

}
